package cz.matasek.dbLogger.exception;

import cz.matasek.dbLogger.database.DatabaseObjectType;

/**
 * Thrown to indicate that table already exists.
 *
 * @author Luboš Matásek
 */
public class ObjectAlreadyExistsException extends DbLoggerRuntimeException {

    /**
     * Default exception message.
     */
    private static final String EXCEPTION_MESSAGE = "already exists";
    /**
     * Serial version UID.
     */
    private static final long serialVersionUID = -8164672077436694534L;

    /**
     * Creates a new <code>ObjectAlreadyExistsException</code> with a message
     * containing name of the existing objecy.
     *
     * @param type database object type
     * @param objectName name of the table
     */
    public ObjectAlreadyExistsException(DatabaseObjectType type, String objectName) {
        super(type + " " + objectName + " " + ObjectAlreadyExistsException.EXCEPTION_MESSAGE);
    }
}
